From cf25093441d43b9225ae0a1a7eceaa31ef3a3d49 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 17 Jan 2002 22:28:02 +0000 Subject: [PATCH] Call gtk_selection_remove_all() here, not in destroy/ finalize. (#66636, Thu Jan 17 17:02:38 2002 Owen Taylor * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call gtk_selection_remove_all() here, not in destroy/ finalize. (#66636, Sergey Vlasov) * gtk/gtkselection.c (gtk_selection_request): Fix reentrancy problem with multiple conversions. * gtk/gtkselection.c (gtk_selection_remove_all): Don't remove incrs, we don't need the widget for maintain the incr. * gtk/gtkselection.c (struct _GtkIncrInfo): Remove the widget field from here, we don't need it. --- ChangeLog | 16 ++++++++++++++++ ChangeLog.pre-2-0 | 16 ++++++++++++++++ ChangeLog.pre-2-10 | 16 ++++++++++++++++ ChangeLog.pre-2-2 | 16 ++++++++++++++++ ChangeLog.pre-2-4 | 16 ++++++++++++++++ ChangeLog.pre-2-6 | 16 ++++++++++++++++ ChangeLog.pre-2-8 | 16 ++++++++++++++++ gtk/gtkselection.c | 21 +++++---------------- gtk/gtkwidget.c | 4 ++-- 9 files changed, 119 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e083ff9ddd..1e10abcd7c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,19 @@ +Thu Jan 17 17:02:38 2002 Owen Taylor + + * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call + gtk_selection_remove_all() here, not in destroy/ + finalize. (#66636, Sergey Vlasov) + + * gtk/gtkselection.c (gtk_selection_request): Fix + reentrancy problem with multiple conversions. + + * gtk/gtkselection.c (gtk_selection_remove_all): + Don't remove incrs, we don't need the widget for + maintain the incr. + + * gtk/gtkselection.c (struct _GtkIncrInfo): Remove + the widget field from here, we don't need it. + Thu Jan 17 13:08:34 2002 Owen Taylor * gdk/x11/gdkmain-x11.c (gdk_error_trap_push): Move diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index d7638787ec..d973e73741 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -102,7 +102,6 @@ struct _GtkIncrConversion struct _GtkIncrInfo { - GtkWidget *widget; /* Selection owner */ GdkWindow *requestor; /* Requestor window - we create a GdkWindow so we can receive events */ GdkAtom selection; /* Selection we're sending */ @@ -547,19 +546,6 @@ gtk_selection_remove_all (GtkWidget *widget) /* Remove pending requests/incrs for this widget */ - tmp_list = current_incrs; - while (tmp_list) - { - next = tmp_list->next; - if (((GtkIncrInfo *)tmp_list->data)->widget == widget) - { - current_incrs = g_list_remove_link (current_incrs, tmp_list); - /* structure will be freed in timeout */ - g_list_free (tmp_list); - } - tmp_list = next; - } - tmp_list = current_retrievals; while (tmp_list) { @@ -1056,8 +1042,9 @@ gtk_selection_request (GtkWidget *widget, return FALSE; info = g_new (GtkIncrInfo, 1); + + g_object_ref (widget); - info->widget = widget; info->selection = event->selection; info->num_incrs = 0; @@ -1211,12 +1198,14 @@ gtk_selection_request (GtkWidget *widget, gdk_selection_send_notify (event->requestor, event->selection, event->target, event->property, event->time); } - + if (info->num_incrs == 0) { g_free (info->conversions); g_free (info); } + + g_object_unref (widget); return TRUE; } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 5a448e9ec3..e2238db7be 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5570,7 +5570,6 @@ gtk_widget_real_destroy (GtkObject *object) g_object_set_qdata (G_OBJECT (widget), quark_accel_closures, NULL); gtk_grab_remove (widget); - gtk_selection_remove_all (widget); g_object_unref (widget->style); widget->style = gtk_widget_get_default_style (); @@ -5589,7 +5588,6 @@ gtk_widget_finalize (GObject *object) GtkAccessible *accessible; gtk_grab_remove (widget); - gtk_selection_remove_all (widget); g_object_unref (widget->style); widget->style = NULL; @@ -5729,6 +5727,8 @@ gtk_widget_real_unrealize (GtkWidget *widget) widget->window = NULL; } + gtk_selection_remove_all (widget); + GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED); } -- 2.30.2